<template>
  <div>
    <div class="container">
      <div class="row">
        <div class="col-12 col-sm-10 col-md-8 col-lg-6 m-auto pd-5" style="height: 500px;">
          <div class="card mt-5">
            <h3 class="card-header text-center bg-white mb-0 text-secondary">
              {{$conf.logo}}
            </h3>
            <div class="card-body">
              <el-form ref="ruleForm" :model="form" :rules="rules">
                <el-form-item label="label" prop="username">
                  <el-input size="medium" v-model="form.username" placeholder="请输入用户名"></el-input>
                </el-form-item>
                <el-form-item label="label" prop="password">
                  <el-input size="medium" v-model="form.password" type="password" placeholder="请输入密码"></el-input>
                </el-form-item>
                <el-form-item>
                  <el-button type="primary" size="medium" class="w-100" @click="submit">立即登录</el-button>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      form: {
        username: '',
        password: ''
      },
      rules: {
        username: [
          {required: true, message: '请输入用户', trigger: 'blur'},
          {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}
        ],
        password: [
          {required: true, message: '请输入密码', trigger: 'blur'},
          {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}
        ],
      }
    }
  },
  methods: {
    submit() {
      this.$refs.ruleForm.validate((e) => {
        if (!e) return
        this.$router.push({name:'index'})
      })
    }
  }
}
</script>

<style scoped lang="scss">

</style>
